import Vue from 'vue'
import store from "./store";
import App from './App'
import $http from './utils/http.js'
import request from './utils/requestInt.js'
import utils from './utils/tooles.js'
import api from './utils/api.js'
import settingConfig from './mixin/settingConfig'
import uView from "uview-ui";
import xsjImage from './components/xsj-image/xsj-image.vue'
import toast from './components/toast/toast.vue'
// 绑定添加方法
Vue.component('xsj-image', xsjImage)
Vue.component('toast', toast)
Vue.prototype.$api = api
Vue.prototype.$https = $http
Vue.prototype.$store = store
Vue.prototype.$onLaunched = new Promise(resolve => {
  Vue.prototype.$isResolve = resolve
})
Object.keys(utils).map((v) => {
  if (!Vue.prototype[v]) {
    Vue.prototype[v] = utils[v]
  } else {
    throw new Error(`试图在给Vue的原型添加属性时候出现冲突,具体方法名为${v}`)
  }
})

Vue.use(uView)
Vue.config.productionTip = false
Vue.mixin(settingConfig)
$http.beforeRequest = request.beforeRequest
$http.afterRequest = request.afterRequest
$http.errorRequest = request.errorRequest
App.mpType = 'app'
const app = new Vue({
  store,
  ...App
})
app.$mount()